﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebApplication.DTO;

namespace WebApplication.DAO
{
    public class searchDAO
    {
        public static Boolean timKey(String key, String CSDL)
        {
            if (CSDL.Contains(key) == true)
            {
                return true;
            }
            return false;
        }
        public static String phanTrang(int soTrang,int page,int tongRecord)
        {
            String kq = "";
            int len = page* 10;
            int moc = page;
            
            int iTruoc = page;
            if (iTruoc-10 < 1)
            {
                iTruoc = 1;
            }
            else
            {
                iTruoc -= 10;
            }
            int iSau = page + 10;
           
                for (int i = page; i < page + 10; i++)
                {
                    if (i <= soTrang)
                    {
                        kq += " " + "<a href='Default.aspx?page=" + i + "'>" + i + "</a>";
                    }
                }
                if (page > 10|| page!=1)
                {
                    kq = "<a href='Default.aspx?page=" + iTruoc + "'>Trước</a>" + kq;
                }

                if (page <= soTrang - 10||page < soTrang)
                {
                    kq += "<a href='Default.aspx?page=" + iSau + "'> Sau</a>";
                }
            return kq;
        }
    }
}